package com.xcity.record;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

import com.xcity.merge.MergeUtil;

public class Guild extends BaseRecord{
	
	public static String SQL_PARA = "id, name, createTime, chairmanId, flag, slogan, joinType, exp, gevent, joinLvl";
	
	public static String COUNT_SQL = "select count(id) from guild";
	public static String SELECT_LIMIT = "select * from guild limit {0},{1}";
	
	protected long id;
	protected String name;
	protected Date createTime;
	protected long chairmanId;
	protected int flag;
	protected String slogan;
	protected byte joinType;
	protected int exp;
	protected String gevent;
	protected byte joinLvl;
	

	@Override
	public void load(ResultSet rs) throws SQLException {
		this.id = rs.getLong(1);
		this.name = rs.getString(2);
		this.createTime = rs.getTimestamp(3);
		this.chairmanId = rs.getLong(4);
		this.flag = rs.getInt(5);
		this.slogan = rs.getString(6);
		this.joinType = rs.getByte(7); 
		this.exp = rs.getInt(8);
		this.gevent = "";//rs.getString(9);
		this.joinLvl = rs.getByte(10);
	}

	@Override
	public String getColumnNames() {
		return SQL_PARA;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(MergeUtil.toSqlString(id));
		sb.append(", ");
		sb.append(MergeUtil.toSqlNameString(name));
		sb.append(", ");
		sb.append(MergeUtil.toDateString(createTime));
		sb.append(", ");
		sb.append(MergeUtil.toSqlString(chairmanId));
		sb.append(", ");
		sb.append(MergeUtil.toSqlString(flag));
		sb.append(", ");
		sb.append(MergeUtil.toSqlNameString(slogan));
		sb.append(", ");
		sb.append(MergeUtil.toSqlString(joinType));
		sb.append(", ");
		sb.append(MergeUtil.toSqlString(exp));
		sb.append(", ");
		sb.append(MergeUtil.toSqlString(gevent));
		sb.append(", ");
		sb.append(MergeUtil.toSqlString(joinLvl));
		return sb.toString();
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public long getChairmanId() {
		return chairmanId;
	}

	public void setChairmanId(long chairmanId) {
		this.chairmanId = chairmanId;
	}

	public int getFlag() {
		return flag;
	}

	public void setFlag(int flag) {
		this.flag = flag;
	}

	public String getSlogan() {
		return slogan;
	}

	public void setSlogan(String slogan) {
		this.slogan = slogan;
	}

	public int getExp() {
		return exp;
	}

	public void setExp(int exp) {
		this.exp = exp;
	}

	public byte getJoinType() {
		return joinType;
	}

	public void setJoinType(byte joinType) {
		this.joinType = joinType;
	}

	public String getGevent() {
		return gevent;
	}

	public void setGevent(String gevent) {
		this.gevent = gevent;
	}

	public byte getJoinLvl() {
		return joinLvl;
	}

	public void setJoinLvl(byte joinLvl) {
		this.joinLvl = joinLvl;
	}
	

}
